import cv2 as cv

filename = r'LENA.jpg'

img = cv.imread(filename)
img1 = cv.resize(img, (400, 400), interpolation=cv.INTER_LANCZOS4)#改变图像尺寸
imgGauss = cv.GaussianBlur(img1, (5, 5), 0)#高斯滤波
imgblur = cv.blur(img1, (1, 15))#均值滤波
medianBlur = cv.medianBlur(img1, 3)#中值滤波

cv.imshow("source image", img1)
cv.imshow("Gaussian filename image", imgGauss)
cv.imshow("blur image", imgblur)
cv.imshow("medianBlur image", medianBlur)
cv.waitKey()
cv.destroyAllWindows()#显示图像
